//
//  UIButton+extension.swift
//  Weibo
//
//  Created by lzing on 16/3/26.
//  Copyright © 2016年 lzing. All rights reserved.
//

import UIKit

extension UIButton {
    convenience init(title: String, titleColor: UIColor = UIColor.lightGrayColor(), titleFont : CGFloat = LZStatusCellDefaultFont, bkgImageName: String = "timeline_card_bottom_background", imageName: String) {
        self.init()
        // 设置背景图
        setBackgroundImage(UIImage(named: bkgImageName), forState: UIControlState.Normal)
        setBackgroundImage(UIImage(named: "\(bkgImageName)_highlighted"), forState: UIControlState.Highlighted)
        // 设置图片
        setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        // 设置按钮title
        setTitle(title, forState: UIControlState.Normal)
        setTitleColor(titleColor, forState: UIControlState.Normal)
        titleLabel?.font = UIFont.systemFontOfSize(titleFont)
    }
}
